#pragma once
#include "StdAfx.h"


//short add log entry function
void _log(string);
void alert(string);
string GetFullPath(string);
void DrawCube(double);
void DrawQuad(double width, double ntiles);
void DrawFloorBox(double width, double height, double ntiles, double nhtiles);
void DrawPrism(float x, float y, float z);
void DrawEnvCube(double size);
void Draw6Toruses(double radius);
void DrawRainbow(double radius, int nElements);
void DrawFullScreenQuad();
Mat44 CalculateWorldMatrix(Vec3, Rotator);
Mat44 TranslationMatrix(Vec3);
Mat44 RotationMatrix(Quat);
Mat44 BiasMatrix(real bias=0.5);
Mat44 ScalingMatrix(Vec3);
Mat44 ViewMatrix(Vec3,Vec3,Vec3);
void TexCoord(Vec3 coords, unsigned int tex_unit=0);
void TexCoord(Vec2 coords, unsigned int tex_unit=0);
void Normal(Vec3);
void Vertex(Vec3);
void TestDraw();
Vec3 vMin(Vec3,Vec3);
Vec3 vMax(Vec3,Vec3);
Vec3 getAxis(Vec3 from, Vec3 to);
Quat getQuat(Vec3 dir);
template<typename T>
BBVector<sptr<Actor>> GetAllActors()
{
	BBVector<sptr<Actor>> actors;
	for(unsigned int i=0;i<globals.Game.MainScene->Actors.size();i++)
	{
		sptr<Actor> actor=globals.Game.MainScene->Actors[i];
		if(dynamic_cast<T*>(actor.get()))
			actors.push_back(actor);
	}
	return actors;
}
template<typename T>
void SwapPtrs(sptr<T> &p1, sptr<T> &p2)
{
	sptr<T> p_temp=p1;
	p1=p2;
	p2=p_temp;
};
Mat44 ProjectionMatrix(double fov, double aspect_ratio, double near_view_plane, double far_view_plane);
Mat44 CalculateInverseWorldMatrix(Vec3, Rotator);
Mat44 GetModelViewProj();
void ThrowError(string str=string());
void ReportError(string str=string());
void ReportError_IL(string str);
void ReportError_GL(string str);
void ReportError_CG(string str);